<!--#include file="Config.asp" -->
<!--#include file="HeadTop.asp"-->
<%
dim rs,sql
intID=cint(Request("id"))
strdate=Trim(Request("currentDate"))


If strdate="" Then
strdate=Date()
Else
strdate=strdate
End If

set rs=server.createobject("adodb.recordset")
sql="select * from Plan_target where T_father_ID="&intID&" and userid="&session("AnyPIM_userID")&" order by T_id desc"
rs.open sql,conn,1,1
If rs.recordcount<>0 then
   rs.PageSize = 4
   Page = CLng(Request("Page"))
   If Page < 1 Then Page = 1
   If Page > rs.PageCount Then Page = rs.PageCount
   PageBegin=rs.PageSize*(Page-1)+1
  if rs.PageSize*PageN< rs.RecordCount then
    PageEnd=rs.PageSize * Page
  else
    PageEnd=rs.RecordCount
  end If
  maxpage=rs.pagecount
  rcount=rs.RecordCount
rs.AbsolutePage = Page
%>



<!-- 列表 -->

<TABLE class="table table-condensed">
<tr bgcolor="#99CCFF"><TD><FONT  COLOR="#FFFFFF"><B>ObjectiveManagement</B></FONT></TD><td align='right' colspan='3' >

<%
  response.write "" & rcount & "/" & maxpage & ",当前显示<font color=red>第" & Page & "页</font>[<font color=red>第" & PageBegin & "条-第" & PageEnd & "条</font>]"%>
<%=Page%>/<%=maxpage%>
<%If Page <> 1 Then ' 如果不是位于第一页 %>
     <A HREF='?Page=1'>[首页]</A>
     <A HREF='?Page=<%=(Page-1)%>'>[上页]</A>
<%End If
  If Page <> maxpage Then ' 如果不是位于最后一页
%>
  <A HREF='?Page=<%=(Page+1)%>'>[下页]</A>
  <A HREF='?Page=<%=maxpage%>'>[末页]</A>
<%End If%>
</FONT>
</td>
</tr>
<%
For iPage = 1 To rs.PageSize
%>
<tr bgcolor='#f6f6f6'>
<td ><b>[<%=rs("T_ID")%>-<%=rs("T_Title")%>]</b>
<FONT COLOR="#00CCFF">T_ID:<%=rs("T_ID")%>-T_Father_ID:<%=rs("T_Father_ID")%></FONT></TD>
<td ><%=rs("T_Begin_Time")%>--<%=rs("T_End_Time")%></TD>
<td ><%If Date()>rs("T_End_Time") then%><A HREF="ObjectiveView.asp?ID=<%=int(rs("T_id"))%>" title='查看目标执行状况'><FONT COLOR="#FF0000"><s>目标已过期</s></FONT></A><%else%><A HREF="ObjectiveView.asp?ID=<%=int(rs("T_id"))%>" title='查看目标执行状况'>> 进度状况</A><%End if%></TD>
<TD><A HREF="ObjectiveEdit.asp?ID=<%=int(rs("T_id"))%>">> 修改</A></TD></tr>
<%
set rson=server.createobject("adodb.recordset")
rsonsql="select * from Plan_target where T_Father_ID="&Int(rs("T_ID"))&" and userid="&session("AnyPIM_userID")&" order by T_ID"
rson.open rsonsql,conn,1,1
for dd=1 to rson.recordcount
%>
<tr >
<td >
&nbsp;>&nbsp;<%=rson("T_ID")%>-<%=rson("T_Father_ID")%>-<%=rson("T_Title")%>
</TD>
<td ><FONT COLOR="#CCCCCC"><%=rson("T_Begin_Time")%>--<%=rson("T_End_Time")%></FONT></TD>
<td ><%If Date()>rson("T_End_Time") then%><A HREF="ObjectiveView.asp?ID=<%=int(rson("T_id"))%>" title='查看目标执行状况'><FONT COLOR="#FF0000"><s>目标已过期</s></FONT></A><%else%><A HREF="ObjectiveView.asp?ID=<%=int(rson("T_id"))%>" title='查看目标执行状况'>> 进度状况</A><%End if%></TD>
<TD><A HREF="ObjectiveEdit.asp?ID=<%=int(rson("T_id"))%>">> 修改</A></TD></tr>
<%
rson.moveNext
Next
rson.close
%>
<%
rs.MoveNext
If rs.EOF Then Exit For
Next
End if
%>
</TR>
</TABLE>
<%
rs.close
%>



<TABLE class="table table-condensed table-bordered">
<FORM METHOD=POST ACTION="?SaveType=AddOK">
	<TR>
		<TD valign='top'>
标题：<INPUT TYPE="text" NAME="T_Title" ><br />
开始：<INPUT TYPE="text" NAME="T_begin_time" value='<%=Date()%>' class="Wdate" onClick="WdatePicker()"><br />

结束：<INPUT TYPE="text" NAME="T_end_time" value='<%=Date()+30%>' class="Wdate" onClick="WdatePicker()">
</TD>
<TD valign='top'>
级别：<SELECT NAME="T_Father_id">
<OPTION VALUE="0" SELECTED>作为顶级目标</option>
<%
'Access
If db_type="Access2003" Or db_type="Access2007" Then
SQL="select * from Plan_target where T_begin_time<=#"&strdate&"# and T_End_time>=#"&strdate&"# and T_Father_ID=0 and userid="&session("AnyPIM_userID")&" order by T_ID desc"
End If

'MsSQL
If db_type="sql2008R2" Then
SQL="select * from Plan_target where T_begin_time<='"&strdate&"' and T_End_time>='"&strdate&"' and T_Father_ID=0 and userid="&session("AnyPIM_userID")&" order by T_ID desc"
End If

rs.open sql,conn,1,1
For s=1 To rs.recordcount
%>
<OPTION VALUE="<%=rs("T_id")%>">父<%=rs("T_Father_id")%>/<%=rs("T_id")%>/<%=trim(rs("T_Title"))%>/<%=trim(rs("T_End_time"))%></OPTION>
<%
rs.moveNext
next
rs.close
%>
</SELECT>
<br />
详细：<TEXTAREA NAME="T_Content" ROWS="3" COLS="50">详细：</TEXTAREA></TD>
<TD>
<%
'AnyPIM_Free_Right权限检测
If session("AnyPIM_RightAdd")=1 then
%>
<INPUT TYPE="submit" value='>> 开始订立目标'>
<%End if%>
</TD>

</TR>
</FORM>
</TABLE>

<!--添加类别  -->



<%
'SQL Precess
Action=request("SaveType")
'Add New Record
If Action="AddOK"  And request("T_title")<>"" then
sql= "SELECT * from Plan_target WHERE (T_ID is null)"
rs.open sql,conn,1,3
rs.addnew
rs("UserID") =session("AnyPIM_userID")
rs("T_Title") =Trim(Request("T_Title"))
rs("T_Father_ID") =Int(Request("T_Father_ID"))
rs("T_content") =Trim(Request("T_content"))
rs("T_begin_time")=Trim(Request("T_begin_time"))
rs("T_End_time")=Trim(Request("T_End_time"))
rs.Update
rs.close
set conn=nothing
response.redirect Request.ServerVariables("Http_referer")
End If


%>

<!-- #include file="foot.asp" -->
